<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta content="text/javascript" http-equiv="content-script-type">
<title>tango.net.SocketConduit</title>

<link rel="stylesheet" type="text/css" href="css/style.css">
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="css/ie56hack.css"><![endif]-->
<script language="JavaScript" src="js/util.js" type="text/javascript"></script>
<script language="JavaScript" src="js/tree.js" type="text/javascript"></script>
<script language="JavaScript" src="js/explorer.js" type="text/javascript"></script>
<script>
function anchorFromTitle(title, path, ext) {
  var url = path + title + "." + ext;
  document.write("<a href='" + url + "'>" + title + "</a>");
  }
</script>
</head><body>
<div id="tabarea"></div><div id="explorerclient"></div>
<div id="content"><script>explorer.initialize("tango.net.SocketConduit");</script>
        <table class="content">
                <tr><td id="docbody"><h1><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327">tango.net.SocketConduit</a></h1>
                
<b>License:</b><br>
BSD style: see <a href="http://www.dsource.org/projects/tango/wiki/LibraryLicense">license.txt</a><br><br>
<b>Version:</b><br>
Mar 2004 : Initial release<br><br>
<b>Version:</b><br>
Jan 2005 : RedShodan patch for timeout query<br><br>
<b>Version:</b><br>
Dec 2006 : Outback release<br><br>
<b>author:</b><br>Kris<br><br>
<script>explorer.outline.incSymbolLevel();</script>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>class <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L34">SocketConduit</a></span>
<script>explorer.outline.addDecl('SocketConduit');</script> : Conduit;</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">A wrapper around the bare Socket to implement the IConduit abstraction
        and add socket-specific functionality.</font><br><br>
<font color="black">SocketConduit data-transfer is typically performed in conjunction with
        an IBuffer, but can happily be handled directly using void array where
        preferred
        
</font><br><br>
<script>explorer.outline.incSymbolLevel();</script>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li><span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L52">this</a></span>
<script>explorer.outline.addDecl('this');</script>();</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Create a streaming Internet Socket</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li><span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L64">this</a></span>
<script>explorer.outline.addDecl('this');</script>(SocketType <span class="funcparam">type</span>, ProtocolType <span class="funcparam">protocol</span>, bool <span class="funcparam">create</span> = true); [protected]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Create an Internet Socket. Used by subclasses and by
                ServerSocket; the latter via method allocate&#40;&#41; below</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>char[] <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L75">toString</a></span>
<script>explorer.outline.addDecl('toString');</script>(); [override]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return the name of this device</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>Socket <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L86">socket</a></span>
<script>explorer.outline.addDecl('socket');</script>();</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return the socket wrapper
                
</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>uint <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L97">bufferSize</a></span>
<script>explorer.outline.addDecl('bufferSize');</script>(); [override]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return a preferred size for buffering conduit I/O</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>Handle <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L111">fileHandle</a></span>
<script>explorer.outline.addDecl('fileHandle');</script>(); [override]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Models a handle-oriented device.</font><br><br>
<b>TODO:</b><br>figure out how to avoid exposing this in the general
                case<br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>SocketConduit <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L123">setTimeout</a></span>
<script>explorer.outline.addDecl('setTimeout');</script>(TimeSpan <span class="funcparam">interval</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Set the read timeout to the specified interval. Set a
                value of zero to disable timeout support.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>bool <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L135">hadTimeout</a></span>
<script>explorer.outline.addDecl('hadTimeout');</script>();</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Did the last operation result in a timeout? </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>bool <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L146">isAlive</a></span>
<script>explorer.outline.addDecl('isAlive');</script>(); [override]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Is this socket still alive?</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>SocketConduit <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L157">connect</a></span>
<script>explorer.outline.addDecl('connect');</script>(Address <span class="funcparam">addr</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Connect to the provided endpoint
        
</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>SocketConduit <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L173">bind</a></span>
<script>explorer.outline.addDecl('bind');</script>(Address <span class="funcparam">address</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Bind the socket. This is typically used to configure a
                listening socket &#40;such as a server or multicast socket&#41;.
                The address given should describe a local adapter, or
                specify the port alone &#40;ADDR_ANY&#41; to have the OS assign
                a local adapter address.
        
</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>SocketConduit <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L197">shutdown</a></span>
<script>explorer.outline.addDecl('shutdown');</script>();</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Inform other end of a connected socket that we're no longer
                available. In general, this should be invoked before close&#40;&#41;
                is invoked
        
                The shutdown function shuts down the connection of the socket: </font><br><br>
<font color="black">-   stops receiving data for this socket. If further data 
                        arrives, it is rejected.<br><br>                    -   stops trying to transmit data from this socket. Also
                        discards any data waiting to be sent. Stop looking for 
                        acknowledgement of data already sent; don't retransmit 
                        if any data is lost.<br><br></font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L213">detach</a></span>
<script>explorer.outline.addDecl('detach');</script>(); [override]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Release this SocketConduit</font><br><br>
<font color="black">Note that one should always disconnect a SocketConduit 
                under normal conditions, and generally invoke shutdown 
                on all connected sockets beforehand<br><br></font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>uint <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L240">read</a></span>
<script>explorer.outline.addDecl('read');</script>(void[] <span class="funcparam">dst</span>); [override]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Read content from the socket. Note that the operation 
                may timeout if method setTimeout&#40;&#41; has been invoked with 
                a non-zero value.</font><br><br>
<font color="black">Returns the number of bytes read from the socket, or
                IConduit.Eof where there's no more content available<br><br>                Note that a timeout is equivalent to Eof. Isolating
                a timeout condition can be achieved via hadTimeout&#40;&#41;<br><br>                Note also that a zero return value is not legitimate;
                such a value indicates Eof<br><br></font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>uint <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L254">write</a></span>
<script>explorer.outline.addDecl('write');</script>(void[] <span class="funcparam">src</span>); [override]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Callback routine to write the provided content to the
                socket. This will stall until the socket responds in
                some manner. Returns the number of bytes sent to the
                output, or IConduit.Eof if the socket cannot write.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>uint <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L270">read</a></span>
<script>explorer.outline.addDecl('read');</script>(void[] <span class="funcparam">dst</span>, uint delegate(void[]) <span class="funcparam">dg</span>); [package, synchronized, final]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Internal routine to handle socket read under a timeout.
                Note that this is synchronized, in order to serialize
                socket access</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>SocketConduit <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L323">allocate</a></span>
<script>explorer.outline.addDecl('allocate');</script>(); [package, synchronized, static]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Allocate a SocketConduit from a list rather than creating
                a new one. Note that the socket itself is not opened; only
                the wrappers. This is because the socket is often assigned
                directly via accept&#40;&#41;</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/SocketConduit.d?rev=3327#L346">deallocate</a></span>
<script>explorer.outline.addDecl('deallocate');</script>(SocketConduit <span class="funcparam">s</span>); [private, synchronized, static]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return this SocketConduit to the free-list</font><br><br></dd></dl>
<script>explorer.outline.decSymbolLevel();</script></dd></dl>
<script>explorer.outline.decSymbolLevel();</script></td></tr>
                <tr><td id="docfooter">
                        Copyright (c) 2004 Kris Bell. All rights reserved :: page rendered by CandyDoc. Generated by <a href="http://code.google.com/p/dil">dil</a> on Tue Mar  4 22:45:33 2008.
                </td></tr>
        </table>
</div>
<script></script>
</body></html>